package cc.telecomdigital.tdstock.trading.Common;

import java.util.ArrayList;
import java.util.List;

public class Trade_StockHistRecord
{
	public String				accountCode;
	List<Trade_StockHistItem>	histItemList;

	/*** A list to store item from GetMultipleOrder **/
	public Trade_StockHistRecord()
	{
		histItemList = new ArrayList<Trade_StockHistItem>();
	}

	/** Object Replacement **/
	public Trade_StockHistRecord(Trade_StockHistRecord iImportRecord)
	{
		SetStockHistoryAccountCode(iImportRecord.accountCode);
		histItemList = new ArrayList<Trade_StockHistItem>();
		histItemList.addAll(iImportRecord.histItemList);
	}

	public void ClearRecord()
	{
		if (histItemList != null)
			histItemList.clear();
		accountCode = "";
	}

	/** Set the unique account code from server **/
	public void SetStockHistoryAccountCode(String iAccountCode)
	{
		accountCode = iAccountCode;
	}

	/** Get a copy of the StockHistItem List **/	
	public List<Trade_StockHistItem> GetStockHistoryRecordList()
	{
		List<Trade_StockHistItem> newList;

		newList = new ArrayList<Trade_StockHistItem>();
		newList.addAll(histItemList);
		return newList;
	}

	public int GetStockHistoryRecordCount()
	{
		if (histItemList == null)
			return 0;

		return histItemList.size();
	}

	/** List Replacement **/
	public void SetStockHistoryRecordList(List<Trade_StockHistItem> iList)
	{
		histItemList.clear();
		if ((iList == null) || (iList.size() == 0))
			return;
		histItemList.addAll(iList);
	}

	public void ClearStockHistoryList()
	{
		histItemList.clear();
	}
}